﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UML2DOC.Controller.Commands;
using System.Windows.Controls;

namespace UML2DOC.Adapters
{
    public class AdapaterGetDiagrams
    {
         private CommandGetSelection _cmdGetDiagrams;
         private int _selectedModelProjectIndex;

        public AdapaterGetDiagrams(ComboBox subject, CommandGetSelection cmdGetDiagrams)
        {
            _cmdGetDiagrams = cmdGetDiagrams;
            _selectedModelProjectIndex = subject.SelectedIndex;

            subject.SelectionChanged +=new SelectionChangedEventHandler(subject_SelectionChanged); 
        }

        public void subject_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            _cmdGetDiagrams.Execute(_selectedModelProjectIndex);
        }
    }
}
